<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="java.net.URLEncoder"%>
<%@page
	import="com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil"%>
<%@page import="com.liferay.portlet.documentlibrary.model.DLFileEntry"%>
<%@page import="com.liferay.portal.kernel.util.UnicodeFormatter"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@ include file="/html/quangcao_admin/init.jsp"%>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%
	long primarykey;
	QuangCao_banner quangcao = null;
	primarykey = ParamUtil.getLong(request, "resourcePrimarykey");
	System.out.println("primarykey" + primarykey);
	quangcao = QuangCao_bannerLocalServiceUtil
			.getQuangCao_banner(primarykey);
%>
<div id="formViewDetail">
	<form class="edit">
		<div class="viewDetailleft">
			<div>
				<label for="name">ID</label> <input size="30" class="pencil"
					type="text" value="<%=quangcao.getUserId()%>" />
			</div>
			<div>
				<label for="web">Tiêu đề quảng cáo</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getTitle()%>" />
			</div>
			<div>
				<label for="email">Tên khách hàng </label> <input size="30"
					class="pencil" type="text"
					value="<%=UserLocalServiceUtil.getUser(quangcao.getUserId())
					.getScreenName()%>" />
			</div>
			<div>
				<label for="web">Loại quảng cáo</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getType()%>" />
			</div>

			<div>
				<label for="web">Link website khách hàng</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getLink()%>" />
			</div>

			<div>
				<label for="web">Số lược click</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getCountClick()%>" />
			</div>
			<div>
				<label for="web">Chiều dài quảng cáo</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getWidthBanner()%>" />
			</div>
			<div>
				<label for="web">Chiều rộng quảng cáo</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getHeightBanner()%>" />
			</div>
			<div>
				<label for="web">Trạng thái quảng cáo</label> <input size="30"
					class="pencil" type="text" value="<%=quangcao.getStatus()%>" />
			</div>
		</div>
		
		<div class="viewDetailRight">
			<div style="width: 620px;">
				<label for="web">Mô tả quảng cáo</label>
				<aui:field-wrapper>
					<liferay-ui:input-editor name="destription"
						toolbarSet="liferay-article" initMethod="initEditor" width="300" />
				</aui:field-wrapper>
			</div>
		</div>
		
		<div style="clear: both;" class="viewDetailBottom">
			<div>
				<label for="web">Banner quảng cáo</label>
				<%
					ThemeDisplay themeDisplay = (ThemeDisplay) request
							.getAttribute(WebKeys.THEME_DISPLAY);
					DLFileEntry entry = DLFileEntryLocalServiceUtil
							.getFileEntry(quangcao.getFileEntryId());
					String url = ("/documents/" + entry.getGroupId() + "/"
							+ entry.getFolderId() + "/" + URLEncoder.encode(
							entry.getTitle(), "UTF-8"));
					String fullUrl = themeDisplay.getPortalURL()
							+ themeDisplay.getPathContext() + url;
					System.out.println("fullUrl" + fullUrl);
				%>
				<img alt="Image Banner" src="<%=fullUrl%>">
			</div>
		</div>
		
	</form>
</div>
<script>
	function <portlet:namespace/>initEditor(){
		return "<%=UnicodeFormatter.toString(quangcao.getDescription())%>";
	}
</script>
